package com.atguigu.ioc;

import org.springframework.beans.factory.FactoryBean;

public class AtguiguFactoryBean implements FactoryBean<HappyComponent> {

    private String componentName;

    public String getComponentName() {
        return componentName;
    }

    public void setComponentName(String componentName) {
        this.componentName = componentName;
    }

    @Override
    public HappyComponent getObject() throws Exception {

        // 假设这里是一个很复杂的创建过程
        HappyComponent happyComponent = new HappyComponent();
        happyComponent.setComponentName(this.componentName);

        return happyComponent;
    }

    @Override
    public Class<?> getObjectType() {
        return HappyComponent.class;
    }
}
